﻿namespace Congstarrechnung
{
    using System.Collections.Generic;

    public class Invoice
    {
        public List<Entry> Entries { get; set; }
        public int SumEinheitenInMin { get; set; }
        public int SumLengthsInSec { get; set; }
        public float SumChargesInCent { get; set; }
        public int SumChargesWithMehrwert { get; set; }

        public Invoice()
        {
            Entries = new List<Entry>();
        }

        public void Add(Entry entry)
        {
            Entries.Add(entry);
            SumEinheitenInMin += entry.Einheiten;
            SumLengthsInSec += entry.LengthInSeconds;
            SumChargesInCent += entry.Charges;
        }

        public void Finalize()
        {
            SumChargesWithMehrwert = (int)(SumChargesInCent + SumChargesInCent * 0.19f + 0.5f);
        }
    }
}
